var crypto = require('crypto');


module.exports = function(cid,number,seq,time,school){
				var result = {},
				seeds = [];
				for(var i = 1;i <= number;i ++){
								var hash = crypto.createHash('sha1');
								hash.update(cid + "");
								hash.update(random(seq));
								if(school){
												seeds.push({"_id":hash.digest('hex'),"tmp":cid});
								}else{
												seeds.push({"_id":hash.digest('hex'),"cid":cid,"time":time});
								}
								seq = seq + 1;
				}
				result.seeds = seeds;
				result.seq = seq;
				return result;
};

function random(seq){
				var md5 = crypto.createHash('md5');
				md5.update(seq + "");
				return md5.digest('hex');
}

/* Example
	 var seed = getSeed("54320265c3344089099040ca",100,233,1).seeds;
	 Key.create(seed,function(err,a,b,c){
	 if(err){
	 console.log("hash重复");
	 } 
	 });
*/
